#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N], b[N];

void solve() {
    int n, idx = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] % 2 == 0) b[idx++] = i;
    }
    sort(a, a + n);
    idx = 0;
    for(int i = 0; i < n; i++) {
        if(a[i] % 2 == 0) {
            if(b[idx++] != i) {
                cout << "No\n";
                return;
            }
        }
    }
    cout << "YES\n";
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}